OpenBuildings GenerativeComponents Help

Function Calls

In GCScript, every function returns a value. (Even a 'void' function returns a value, which is always null.) However, in many cases, the return value isn't significant, or is only a byproduct of the function's primary purpose. For those kinds of functions, you can simply call the function as a statement, and ignore the result value.

Example

Print('Hello');       //
We call the Print function because of its
                     
// effect (of printing something to the script
                     
// console window), not because of its result
                     
// value (which is always null).

On the other hand, many functions will not allow themselves to be called as statements. Each of those functions has the sole purpose of providing a result, and therefore nothing would be accomplished by ignoring that result.

Example

Sqrt(5);      // This statement
will cause an error, because
                     
// it doesn't accomplish anything. We're telling
                     
// GC to calculate the square root of 5, but
                     
// then we're not doing anything with the result
                    
 // of that calculation!
double k = Sqrt(5);   // This is better.